package com.peanut.youfupay.service.other.charge;


import com.alibaba.fastjson.JSON;
import com.peanut.youfupay.entity.charge.QueryRechargeResultDTO;
import com.peanut.youfupay.entity.charge.QueryRechargeResultResponseDTO;
import com.peanut.youfupay.entity.response.ResponseMessage;
import com.peanut.youfupay.enums.FunCodeEnum;
import com.peanut.youfupay.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 查询某次充值结果
 *
 * @Author :  peanut
 */
@Slf4j
@Service("queryApplyRechargeResultServiceImpl")
public class QueryApplyRechargeResultServiceImpl extends BaseService {
    /**
     * @param funCodeEnum
     * @param queryRechargeResultDTO
     * @return
     * @throws Exception
     */
    public QueryRechargeResultResponseDTO doBusiness(FunCodeEnum funCodeEnum, QueryRechargeResultDTO queryRechargeResultDTO) throws Exception {
        log.info("查询本次充值结果开始:{}，{}", funCodeEnum, queryRechargeResultDTO);
        ResponseMessage responseMessage = applyYouFuByHttpPost(funCodeEnum, queryRechargeResultDTO);
        QueryRechargeResultResponseDTO queryRechargeResultResponseDTO = JSON.parseObject(responseMessage.getResData(), QueryRechargeResultResponseDTO.class);
        log.info("查询本次充值结果结束:{}", queryRechargeResultResponseDTO);
        return queryRechargeResultResponseDTO;
    }
}
